#include "my_widget.h"

MyWidget::MyWidget(QWidget *parent) : QWidget(parent) {
    // 设置鼠标追踪
    setMouseTracking(true);
}

void MyWidget::enterEvent(QEvent *event) {
    qDebug() << "鼠标进入了指定区域";
}

void MyWidget::leaveEvent(QEvent *event) {
    qDebug() << "鼠标离开了指定区域";
}

void MyWidget::mouseMoveEvent(QMouseEvent *event) {
    QString string = QString("鼠标在指定区域移动 X = %1 Y = %2").arg(event->x()).arg(event->y());

    qDebug() << string;
}
